﻿<Application 
    x:Class="Bindable.Linq.TestApplication.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="MainWindow.xaml"
    >
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Resources/BrushResources.xaml" />
                <ResourceDictionary Source="/Resources/ButtonResources.xaml" />
                <ResourceDictionary Source="/Resources/ConverterResources.xaml" />
                <ResourceDictionary Source="/Resources/ImageResources.xaml" />
                <ResourceDictionary Source="/Resources/ListBoxResources.xaml" />
                <ResourceDictionary Source="/Resources/NotificationResources.xaml" />
                <ResourceDictionary Source="/Resources/TextResources.xaml" />
                <ResourceDictionary Source="/Resources/ToolbarResources.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <!-- Default styles -->
            <Style TargetType="Border">
                <Setter Property="SnapsToDevicePixels" Value="True" />
            </Style>
            <Style TargetType="TextBlock">
                <Setter Property="FontSize" Value="10pt" />
            </Style>

            <Style TargetType="{x:Type TextBox}">
                <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
                <Setter Property="FocusVisualStyle" Value="{x:Null}" />
                <Setter Property="AllowDrop" Value="true" />
                <Setter Property="FontSize" Value="12pt" />
                <Setter Property="FontWeight" Value="Normal" />
                <Setter Property="Cursor" Value="IBeam" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TextBox}">
                            <Grid>
                                <Border BorderBrush="#33FFFFFF" BorderThickness="0,0,1,1" CornerRadius="9" SnapsToDevicePixels="True">
                                    <Border x:Name="Border" BorderBrush="RoyalBlue" BorderThickness="1" SnapsToDevicePixels="True" CornerRadius="7">
                                        <Border BorderBrush="#55FFFFFF" BorderThickness="1" CornerRadius="7" Padding="7" SnapsToDevicePixels="True">
                                            <Border.Background>
                                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                                    <GradientStop Color="White" Offset="0.7" />
                                                    <GradientStop Color="LightBlue" Offset="1" />
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <ScrollViewer Margin="0" x:Name="PART_ContentHost" Style="{DynamicResource SimpleTextScrollViewer}"  />
                                        </Border>
                                    </Border>
                                </Border>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border" />
                                    <Setter Property="BorderBrush" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border" />
                                    <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}" />
                                </Trigger>
                                <Trigger Property="IsFocused" Value="True">
                                    <Setter Property="BorderBrush" Value="Orange" TargetName="Border" />
                                </Trigger>
                                <Trigger Property="Validation.HasError" Value="True">
                                    <Setter Property="BorderBrush" Value="Red" TargetName="Border" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Validation.ErrorTemplate">
                    <Setter.Value>
                        <ControlTemplate>
                            <DockPanel LastChildFill="True">
                                <TextBlock
                                    DockPanel.Dock="Right"
                                    Foreground="Red"
                                    FontSize="12pt"
                                    VerticalAlignment="Center"
                                    Text="{Binding ElementName=MyAdorner, 
                                Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"
                            >
                                </TextBlock>
                                <Border>
                                    <AdornedElementPlaceholder Name="MyAdorner" />
                                </Border>
                            </DockPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

        </ResourceDictionary>
    </Application.Resources>
</Application>
